package com.czxy.Test;

import com.czxy.domain.User;
import com.czxy.service.UserService;
import com.github.pagehelper.PageInfo;

import java.util.Date;
import java.util.List;

public class demo02 {
    public static void main(String[] args) {

        m05();

    }

    //根据主键删除

    public  static  void m05() {

        UserService userService = new UserService();

        userService.del(3);


    }








    //添加
    public  static  void m04() {

        UserService userService = new UserService();
        User user = new User(null,"王五",new Date(),"女","广州");
        userService.add(user);


    }


    //分页查询
    public  static  void m03(){

        UserService userService = new UserService();
        PageInfo pageInfo = userService.findByPg(1, 1);
        List<User> list = pageInfo.getList();

        for (User u : list) {

            System.out.println(u);

        }

    }



    //根据主键查询
    public  static  void m02(){

        UserService userService = new UserService();
        User user = new User();
        user.setUid(1);
        User u = userService.findByPk(user);
        System.out.println(u);
    }



    //查询所有
    public  static  void m01(){

        UserService userService = new UserService();
        List<User> list = userService.findAll();

        for (User u : list) {
            System.out.println(u);
        }
    }
}
